import subprocess
import os


def run_command(command):
    try:
        # 执行Linux命令方式一：
        result =os.system(command)  
        # 执行Linux命令方式二：
        # result =subprocess.run(command.split(), check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, shell=True)
        return result
    except Exception as e:
        print(f"Error executing command: {e}")
        return None
    
if __name__ == '__main__':
    command1="docker-compose -f himart-test/Docker/docker-compose.nginx.yml up -d"
    command2="docker-compose -f himart-test/Docker/docker-compose.mall.yml up -d"
    command3="docker-compose -f himart-test/Docker/docker-compose.mobsf.yml up -d"
    command4="docker-compose -f himart-test/Docker/docker-compose.jenkins.yml up -d"
    run_command(command1)
    run_command(command2)
    run_command(command3)
    run_command(command4)